package com.tedu.api.thread;

import java.io.File;
import java.io.FileFilter;

public class testLambdaHomeWork2{
    public static void main(String[] args) {
        //4.找I0流---File类---“FilterAPI”:转换成匿名内部类转成Lambda【2行】
        File file = new File(".");
        //转换成匿名内部类
        File[] subs = file.listFiles(new FileFilter() {
            public boolean accept(File pathname) {
                return pathname.getName().startsWith("s");
            }
        });
        for (File sub : subs) {
            System.out.println("文件：" + sub.getName());
        }
        //转换成Lambda表达式【2行】
        subs = file.listFiles(pathname -> pathname.getName().startsWith("s"));
        for (File sub : subs) {
            System.out.println("文件夹:" + sub.getName());
        }
    }
}
